﻿using Exam.infranstuctrue.Dto.Respones;
using Exam.infranstuctrue.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Exam.Service.Instance
{
    public class BaseService
    {
        public ApiResult GetResult(int code, string message = "", object? data = null)
        {
            var result = new ApiResult()
            {
                data = data
            };
            if (code > 0)
            {
                result.code = ApiCode.ok;
                result.message = "操作成功";
            }
            else
            {
                result.code = ApiCode.fail;
                result.message = "操作失败";
            }
            if (!string.IsNullOrEmpty(result.message))
            {
                result.message = message;
            }
            return result;
        }
    
    }
}
